﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Upreader.Application.Model;

namespace Upreader.Engine
{
    class FileAssembleState
    {
        #region Fields
        
        private readonly File _file;
        private readonly string _downloadPath;
        private readonly SortedSet<Segment> _pendingSegments;

        #endregion // Fields

        #region Constructor
        
        public FileAssembleState(File file, string downloadPath)
        {
            if (file == null)
                throw new ArgumentNullException("file");
            if (downloadPath == null)
                throw new ArgumentNullException("downloadPath");

            _file = file;
            _downloadPath = downloadPath;
            _pendingSegments = new SortedSet<Segment>(new SegmentIndexComparer());
        }

        #endregion // Constructor

        #region Properties

        public SortedSet<Segment> PendingSegments { get { return _pendingSegments; } }

        public File File { get { return _file; } }

        public string DownloadPath { get { return _downloadPath; } }

        #endregion // Properties
    }
}
